
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>cmake · Aivin开发笔记</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="Aivin">
        
        
    
    <link rel="stylesheet" href="../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search-plus/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-anchor-navigation-ex/style/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-versions-select/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-tbfed-pagefooter/footer.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-donate/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-local-video/video-js.min.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-theme-comscore/test.css">
                
            
        

    

    
        
        <link rel="stylesheet" href="../../styles/website.css">
        
    

        
    
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="Android.mk模板.html" />
    
    
    <link rel="prev" href="NDK编译基础.html" />
    

    
        <link rel="shortcut icon" href='../../assets/images/favicon.ico' type="image/x-icon">
    
    
        <link rel="bookmark" href='../../assets/images/favicon.ico' type="image/x-icon">
    
    
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../">
            
                <a href="../../">
            
                    
                    项目说明
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../linux/linux基础.html">
            
                <a href="../linux/linux基础.html">
            
                    
                    linux
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../linux/linux基础.html">
            
                <a href="../linux/linux基础.html">
            
                    
                    linux基础
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../linux/android底层开发.html">
            
                <a href="../linux/android底层开发.html">
            
                    
                    android底层开发
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../c语言/c基础.html">
            
                <a href="../c语言/c基础.html">
            
                    
                    c
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../c语言/c基础.html">
            
                <a href="../c语言/c基础.html">
            
                    
                    c基础
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../c++/c++基础.html">
            
                <a href="../c++/c++基础.html">
            
                    
                    c++
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../c++/c++基础.html">
            
                <a href="../c++/c++基础.html">
            
                    
                    c++基础
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../QT/QT基础.html">
            
                <a href="../QT/QT基础.html">
            
                    
                    QT
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="../QT/QT基础.html">
            
                <a href="../QT/QT基础.html">
            
                    
                    QT基础
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="../jni/JNI基础.html">
            
                <a href="../jni/JNI基础.html">
            
                    
                    JNI
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="../jni/JNI基础.html">
            
                <a href="../jni/JNI基础.html">
            
                    
                    JNI基础
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="../jni/JNI例子.html">
            
                <a href="../jni/JNI例子.html">
            
                    
                    JNI例子
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="../SDL/SDL基础.html">
            
                <a href="../SDL/SDL基础.html">
            
                    
                    SDL
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="../SDL/SDL基础.html">
            
                <a href="../SDL/SDL基础.html">
            
                    
                    SDL基础
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="../ffmpeg/ffmpeg基础.html">
            
                <a href="../ffmpeg/ffmpeg基础.html">
            
                    
                    ffmpeg
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.8.1" data-path="../ffmpeg/ffmpeg基础.html">
            
                <a href="../ffmpeg/ffmpeg基础.html">
            
                    
                    ffmpeg基础
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.2" data-path="../ffmpeg/ffmpeg示例代码.html">
            
                <a href="../ffmpeg/ffmpeg示例代码.html">
            
                    
                    ffmpeg示例代码
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.3" data-path="../ffmpeg/ffmpeg软解rtsp简单直播.html">
            
                <a href="../ffmpeg/ffmpeg软解rtsp简单直播.html">
            
                    
                    ffmpeg软解rtsp简单直播
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.4" data-path="../ffmpeg/rtsp服务器.html">
            
                <a href="../ffmpeg/rtsp服务器.html">
            
                    
                    rtsp服务器Windows
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="../opencv/opencv模块.html">
            
                <a href="../opencv/opencv模块.html">
            
                    
                    opencv模块
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.9.1" data-path="../opencv/opencv.html">
            
                <a href="../opencv/opencv.html">
            
                    
                    opencv
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="../openSLES/openSLES基础.html">
            
                <a href="../openSLES/openSLES基础.html">
            
                    
                    openSLES
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.10.1" data-path="../openSLES/openSLES基础.html">
            
                <a href="../openSLES/openSLES基础.html">
            
                    
                    openSLES基础
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.11" data-path="../SoundTouch/移植SoundTouch.html">
            
                <a href="../SoundTouch/移植SoundTouch.html">
            
                    
                    SoundTouch
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.11.1" data-path="../SoundTouch/移植SoundTouch.html">
            
                <a href="../SoundTouch/移植SoundTouch.html">
            
                    
                    移植SoundTouch
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.2" data-path="../SoundTouch/实现音频变速和变调.html">
            
                <a href="../SoundTouch/实现音频变速和变调.html">
            
                    
                    实现音频变速和变调
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.12" data-path="../openGLES/openGLES基础.html">
            
                <a href="../openGLES/openGLES基础.html">
            
                    
                    openGLES模块
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.12.1" data-path="../openGLES/GLSL基础.html">
            
                <a href="../openGLES/GLSL基础.html">
            
                    
                    GLSL基础
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.2" data-path="../openGLES/openglES示例.html">
            
                <a href="../openGLES/openglES示例.html">
            
                    
                    openglES示例
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.13" data-path="../视频相关/音视频基础.html">
            
                <a href="../视频相关/音视频基础.html">
            
                    
                    音视频术语-文件格式-协议
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.13.1" data-path="../视频相关/音视频基础.html">
            
                <a href="../视频相关/音视频基础.html">
            
                    
                    音视频基础
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.2" data-path="../视频相关/RTSP.html">
            
                <a href="../视频相关/RTSP.html">
            
                    
                    RTSP
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.3" data-path="../视频相关/RTP.html">
            
                <a href="../视频相关/RTP.html">
            
                    
                    RTP
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.4" data-path="../视频相关/RTCP.html">
            
                <a href="../视频相关/RTCP.html">
            
                    
                    RTCP
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.5" data-path="../视频相关/H264.html">
            
                <a href="../视频相关/H264.html">
            
                    
                    H264
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.6" data-path="../视频相关/YUV.html">
            
                <a href="../视频相关/YUV.html">
            
                    
                    YUV
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.7" data-path="../视频相关/SurfaceView.html">
            
                <a href="../视频相关/SurfaceView.html">
            
                    
                    SurfaceView
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.8" data-path="../视频相关/RTMP.html">
            
                <a href="../视频相关/RTMP.html">
            
                    
                    RTMP
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.9" data-path="../视频相关/AAC详解.html">
            
                <a href="../视频相关/AAC详解.html">
            
                    
                    AAC详解
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.14" data-path="../音视频相关代码/音视频相关代码.html">
            
                <a href="../音视频相关代码/音视频相关代码.html">
            
                    
                    音视频相关代码
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15" data-path="NDK编译基础.html">
            
                <a href="NDK编译基础.html">
            
                    
                    NDK工程编译
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.15.1" data-path="NDK编译基础.html">
            
                <a href="NDK编译基础.html">
            
                    
                    NDK编译基础
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.15.2" data-path="cmake方式.html">
            
                <a href="cmake方式.html">
            
                    
                    cmake
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.3" data-path="Android.mk模板.html">
            
                <a href="Android.mk模板.html">
            
                    
                    Android.mk
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.4" data-path="Application.mk模板.html">
            
                <a href="Application.mk模板.html">
            
                    
                    Application.mk
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../.." >cmake</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div class="search-plus" id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <div id="anchor-navigation-ex-navbar"><i class="fa fa-navicon"></i><ul><li><span class="title-icon "></span><a href="#cmake&#x65B9;&#x5F0F;"><b>1. </b>cmake&#x65B9;&#x5F0F;</a></li><ul><li><span class="title-icon "></span><a href="#cmake&#xFF1A;"><b>1.1. </b>CMake&#xFF1A;</a></li><li><span class="title-icon "></span><a href="#lldb"><b>1.2. </b>LLDB</a></li><li><span class="title-icon "></span><a href="#androidstudio22-&#x8F93;&#x51FA;c&#x4EE3;&#x7801;log&#x4FE1;&#x606F;"><b>1.3. </b>androidstudio2.2+ &#x8F93;&#x51FA;c&#x4EE3;&#x7801;log&#x4FE1;&#x606F;</a></li><li><span class="title-icon "></span><a href="#buildgradle-&#x90E8;&#x5206;&#x914D;&#x7F6E;"><b>1.4. </b>build.gradle &#x90E8;&#x5206;&#x914D;&#x7F6E;</a></li><li><span class="title-icon "></span><a href="#cmakeliststxt-&#x90E8;&#x5206;&#x914D;&#x7F6E;"><b>1.5. </b>CMakeLists.txt &#x90E8;&#x5206;&#x914D;&#x7F6E;</a></li><ul><li><span class="title-icon "></span><a href="#cmakeliststxt-&#x8BF4;&#x660E;"><b>1.5.1. </b>CMakeLists.txt &#x8BF4;&#x660E;</a></li></ul></ul></ul></div><a href="#cmake&#x65B9;&#x5F0F;" id="anchorNavigationExGoTop"><i class="fa fa-arrow-up"></i></a><h1 id="cmake&#x65B9;&#x5F0F;"><a name="cmake&#x65B9;&#x5F0F;" class="anchor-navigation-ex-anchor" href="#cmake&#x65B9;&#x5F0F;"><i class="fa fa-link" aria-hidden="true"></i></a>1. cmake&#x65B9;&#x5F0F;</h1>
<p>Android &#x5BF9; CMake&#x7684;&#x8BF4;&#x660E;&#x8BF7;&#x53C2;&#x8003; <a href="https://developer.android.com/ndk/guides/cmake.html#variables" target="_blank">CMake API </a>  &#x3001; <a href="https://cmake.org/" target="_blank">CMake&#x5B98;&#x7F51;</a></p>
<pre><code class="lang-xml">androidStudio &#x5728;2.2&#x4E4B;&#x524D;&#x5BF9; C/C++ &#x652F;&#x6301;&#x4E0D;&#x662F;&#x5F88;&#x53CB;&#x597D;&#xFF0C;&#x6CA1;&#x6709;&#x8BED;&#x6CD5;&#x63D0;&#x793A;&#xFF0C;&#x914D;&#x7F6E;&#x7F16;&#x8BD1;&#x4E5F;&#x4E0D;&#x65B9;&#x4FBF; &#x3002;
&#x4ECE;androidStudio 2.2&#x6B63;&#x5F0F;&#x7248;&#x5F00;&#x59CB; &#xFF0C;&#x91C7;&#x7528;&#x4E86;cmake&#x65B9;&#x5F0F;&#x7F16;&#x8BD1;&#xFF0C;&#x7B80;&#x5316;&#x4E86;&#x7F16;&#x8BD1;&#x914D;&#x7F6E; &#x3002;
&#x53EF;&#x4EE5;&#x4E0D;&#x7528;&#x518D;&#x624B;&#x52A8;&#x8F93;&#x5165; javac&#x3001;javah&#x547D;&#x4EE4;&#x7B49;&#x3002;
</code></pre>
<h2 id="cmake&#xFF1A;"><a name="cmake&#xFF1A;" class="anchor-navigation-ex-anchor" href="#cmake&#xFF1A;"><i class="fa fa-link" aria-hidden="true"></i></a>1.1. CMake&#xFF1A;</h2>
<p>Android Studio &#x9ED8;&#x8BA4;&#x4F7F;&#x7528; CMake &#x7F16;&#x8BD1;&#x539F;&#x751F;&#x5E93;&#xFF0C;&#x5982;&#x679C;&#x4F60;&#x53EA;&#x6253;&#x7B97;&#x7528;ndk-build&#x6765;&#x7F16;&#x8BD1;&#x7684;&#x8BDD;&#xFF0C;&#x4F60;&#x5C31;&#x4E0D;&#x9700;&#x8981;&#x8FD9;&#x4E2A;&#x7EC4;&#x4EF6;&#x3002;CMake&#x662F;AndroidStudio2.2&#x63D0;&#x4F9B;&#x7684;&#x6784;&#x5EFA;C&#x9879;&#x76EE;&#x7684;&#x5DE5;&#x5177;</p>
<h2 id="lldb"><a name="lldb" class="anchor-navigation-ex-anchor" href="#lldb"><i class="fa fa-link" aria-hidden="true"></i></a>1.2. LLDB</h2>
<p>&#x4F7F;&#x7528;&#x5B83;&#x6765;&#x8C03;&#x8BD5;&#x672C;&#x5730;&#x4EE3;&#x7801;&#x3002;</p>
<h2 id="androidstudio22-&#x8F93;&#x51FA;c&#x4EE3;&#x7801;log&#x4FE1;&#x606F;"><a name="androidstudio22-&#x8F93;&#x51FA;c&#x4EE3;&#x7801;log&#x4FE1;&#x606F;" class="anchor-navigation-ex-anchor" href="#androidstudio22-&#x8F93;&#x51FA;c&#x4EE3;&#x7801;log&#x4FE1;&#x606F;"><i class="fa fa-link" aria-hidden="true"></i></a>1.3. androidstudio2.2+ &#x8F93;&#x51FA;c&#x4EE3;&#x7801;log&#x4FE1;&#x606F;</h2>
<pre><code class="lang-html">1&#x3001; error: undefined reference to &apos;__android_log_print&apos;
app&#x5C42;&#x7684; gradle &#x4E2D; defaultConfig &#x6807;&#x7B7E;&#x4E0B; &#x8FDB;&#x884C;&#x914D;&#x7F6E;
ndk {
    //&#x5C31;&#x662F;&#x4F9D;&#x8D56;ndk&#x5DE5;&#x5177;&#x5305;&#x4E2D;&#x7684;&#x4E00;&#x4E2A;liblog.so&#x6587;&#x4EF6;
ldLibs &quot;log&quot;
}
2&#x3001;cmake&#x4E2D;&#x5BF9;log&#x7684;&#x914D;&#x7F6E;&#x4F7F;&#x7528;&#x9ED8;&#x8BA4;&#x7684;&#x5373;&#x53EF; &#x3002;

3&#x3001;//&#x5BFC;&#x5165;log&#x5305;
#include <span class="hljs-tag">&lt;<span class="hljs-name">android</span>/<span class="hljs-attr">log.h</span>&gt;</span>
//&#x5B9A;&#x4E49;log&#x6807;&#x7B7E;&#xFF0C;&#x540D;&#x5B57;&#x968F;&#x610F;
#define LOG_TAG  &quot;C_TAG&quot;
//&#x5B9A;&#x4E49;&#x65E5;&#x5FD7;&#x7EA7;&#x522B;
#define LOGD(...)  __android_log_print  (ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)
//&#x6253;&#x5370;log
jint value = 1000 ;
LOGD(&quot;value=%d&quot;, value);
LOGD(&quot;value=%d&quot;, 100);

4&#x3001;&#x6709;&#x4E9B;&#x624B;&#x673A;&#x80FD;&#x8F93;&#x51FA;Java&#x4E2D;&#x7684;log&#xFF0C;&#x5374;&#x4E0D;&#x80FD;&#x8F93;&#x51FA;c&#x4EE3;&#x7801;&#x4E2D;&#x7684;log &#x3002;
&#x539F;&#x56E0;&#x53EF;&#x80FD;&#x8DDF;&#x624B;&#x673A;&#x7684;&#x8BBE;&#x7F6E;&#x6709;&#x5173;&#x7CFB;&#x3002; &#x5728;&#x5F00;&#x53D1;&#x8005;&#x9009;&#x9879;&#x4E2D;&#x8FDB;&#x884C;&#x76F8;&#x5173;&#x8BBE;&#x7F6E;&#x5373;&#x53EF;&#x3002;
</code></pre>
<h2 id="buildgradle-&#x90E8;&#x5206;&#x914D;&#x7F6E;"><a name="buildgradle-&#x90E8;&#x5206;&#x914D;&#x7F6E;" class="anchor-navigation-ex-anchor" href="#buildgradle-&#x90E8;&#x5206;&#x914D;&#x7F6E;"><i class="fa fa-link" aria-hidden="true"></i></a>1.4. build.gradle &#x90E8;&#x5206;&#x914D;&#x7F6E;</h2>
<pre><code class="lang-xml">// &#x6307;&#x660E;&#x9879;&#x76EE;&#x4E2D;&#x9700;&#x8981;&#x7528;&#x5230;&#x7684; &#x7B2C;&#x4E09;&#x65B9;&#x7684; .so , .a &#x6587;&#x4EF6;
sourceSets {
    main {
        // &#x5982;&#x679C;&#x4E0D;&#x914D;&#x7F6E;&#xFF0C;android&#x5C31;&#x9ED8;&#x8BA4;&#x4F7F;&#x7528;&#x8FD9;&#x4E2A;&#x8DEF;&#x5F84;
        jniLibs.srcDirs = [&apos;src/main/jniLibs&apos;]
        // &#x5982;&#x679C;&#x559C;&#x6B22;&#x653E; libs&#x76EE;&#x5F55;&#xFF0C;&#x53EF;&#x4EE5;&#x76F4;&#x63A5;&#x8FD9;&#x6837;&#x5199;
        //jniLibs.srcDirs = [&apos;libs&apos;]
    }
}

ndk{
    // &#x6307;&#x660E;&#x53EA;&#x7F16;&#x8BD1;&#x7684;&#x5BF9;&#x5E94;&#x7684;cpu&#x7C7B;&#x578B;
    abiFilters &quot;armeabi-v7a&quot;
}

cmake {
    cppFlags &quot;-std=c++11 -frtti -fexceptions&quot;
    // &#x8BA9;CMake&#x6784;&#x5EFA;&#x539F;&#x751F;&#x5E93;&#x65F6;&#x652F;&#x6301;&#x201C;NEON&#x201D;,&#x9ED8;&#x8BA4;&#x7684;&#x662F;&#x4E0D;&#x652F;&#x6301;
    arguments &quot;-DANDROID_ARM_NEON=TRUE&quot;
}
</code></pre>
<h2 id="cmakeliststxt-&#x90E8;&#x5206;&#x914D;&#x7F6E;"><a name="cmakeliststxt-&#x90E8;&#x5206;&#x914D;&#x7F6E;" class="anchor-navigation-ex-anchor" href="#cmakeliststxt-&#x90E8;&#x5206;&#x914D;&#x7F6E;"><i class="fa fa-link" aria-hidden="true"></i></a>1.5. CMakeLists.txt &#x90E8;&#x5206;&#x914D;&#x7F6E;</h2>
<pre><code class="lang-xml">#&#x8FD9;&#x91CC;&#x8BBE;&#x5B9A;&#x5DE5;&#x7A0B;&#x8DEF;&#x5F84;  &#xFF0C; &#x7B49;&#x540C;&#x4E8E;  CMAKE_SOURCE_DIR
# set(PROGRAM_PATH &quot;E:/test-fffffmpeg/WkNative/app&quot;)

# &#x6279;&#x91CF;&#x5BFC;&#x5165;rtsp &#x76F8;&#x5173;&#x4EE3;&#x7801;
file( GLOB_RECURSE wkrtsp_cpp &quot;src/main/cpp/rtspclient/src/*.cpp&quot;)
file( GLOB_RECURSE wkrtsp_c &quot;src/main/cpp/rtspclient/src/*.c&quot;)
add_library(wkrtsp-lib
             SHARED
             ${wkrtsp_c}
             ${wkrtsp_cpp})

#&#x5BFC;&#x5165;&#x5DF2;&#x7ECF;&#x7F16;&#x8BD1;&#x597D;&#x7684;opencv&#x5E93;-&#x5934;&#x6587;&#x4EF6;
include_directories( src/main/cpp/OpenCV/include )
# &#x5BFC;&#x5165; opencv &#x7684;so
add_library(libopencv_world
            SHARED
            IMPORTED )
set_target_properties( libopencv_world
                       PROPERTIES
                       IMPORTED_LOCATION
                       ${CMAKE_SOURCE_DIR}/src/main/jniLibs/armeabi-v7a/libopencv_world.so
                       )
</code></pre>
<h3 id="cmakeliststxt-&#x8BF4;&#x660E;"><a name="cmakeliststxt-&#x8BF4;&#x660E;" class="anchor-navigation-ex-anchor" href="#cmakeliststxt-&#x8BF4;&#x660E;"><i class="fa fa-link" aria-hidden="true"></i></a>1.5.1. CMakeLists.txt &#x8BF4;&#x660E;</h3>
<pre><code class="lang-c"><span class="hljs-meta"># &#x6DFB;&#x52A0;&#x4E86;c++11&#x7684;&#x652F;&#x6301;</span>
<span class="hljs-built_in">set</span>(CMAKE_CXX_FLAGS <span class="hljs-string">&quot;${CMAKE_CXX_FLAGS} -std=gnu++11&quot;</span>)
<span class="hljs-meta"># &#x6B64;&#x6807;&#x5FD7;&#x5728;&#x94FE;&#x63A5;&#x6210;&#x5171;&#x4EAB;&#x5E93;&#x65F6;&#x6709;&#x6548;</span>
<span class="hljs-built_in">set</span>(CMAKE_SHARED_LINKER_FLAGS <span class="hljs-string">&quot;${CMAKE_SHARED_LINKER_FLAGS} -Wall -v -Wl,--no-warn-shared-textrel&quot;</span>)

<span class="hljs-meta"># &#x7CFB;&#x7EDF;&#x5E93;&#xFF0C;&#x6253;&#x5370;&#x65E5;&#x5FD7;</span>
find_library( <span class="hljs-built_in">log</span>-lib  <span class="hljs-built_in">log</span> )
<span class="hljs-meta"># &#x7CFB;&#x7EDF;&#x5E93; &#xFF0C;&#x538B;&#x7F29;&#x5E93;</span>
find_library( z-lib  z )
<span class="hljs-meta"># &#x6570;&#x5B66;&#x8BA1;&#x7B97;</span>
find_library( m-lib  m )
</code></pre>
<footer class="page-footer"><span class="copyright">&#x65E0;&#x7248;&#x6743; &#x53EF;&#x4EE5;&#x65E0;&#x9650;&#x5236;&#x4F7F;&#x7528;&#xFF01; all right reserved&#xFF0C;powered by Gitbook</span><span class="footer-modification">&#x8BE5;&#x6587;&#x4EF6;&#x66F4;&#x65B0;&#x65F6;&#x95F4;&#xFF1A;
2019-12-18 14:42:27
</span></footer>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="NDK编译基础.html" class="navigation navigation-prev " aria-label="Previous page: NDK编译基础">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="Android.mk模板.html" class="navigation navigation-next " aria-label="Next page: Android.mk">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"cmake","level":"1.15.2","depth":2,"next":{"title":"Android.mk","level":"1.15.3","depth":2,"path":"chinese/ndk/Android.mk模板.md","ref":"chinese/ndk/Android.mk模板.md","articles":[]},"previous":{"title":"NDK编译基础","level":"1.15.1","depth":2,"path":"chinese/ndk/NDK编译基础.md","ref":"chinese/ndk/NDK编译基础.md","articles":[]},"dir":"ltr"},"config":{"plugins":["-search","search-plus","todo","anchor-navigation-ex","copy-code-button","versions-select","fontsettings","sharing","tbfed-pagefooter","donate","local-video","splitter","edit-link","expandable-chapters","favicon","theme-comscore","local-video"],"styles":{"website":"styles/website.css"},"pluginsConfig":{"tbfed-pagefooter":{"copyright":"无版权 可以无限制使用！","modify_label":"该文件更新时间：","modify_format":"YYYY-MM-DD HH:mm:ss"},"todo":{},"splitter":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"versions-select":{"type":"branches"},"donate":{"alipay":"https://gitee.com/hnyer/filesOfGitbook/raw/master/files/201803011956_osChina_支付宝收款码.png","alipayText":"支付宝打赏","button":"打赏","title":"","wechat":"https://gitee.com/hnyer/filesOfGitbook/raw/master/files/201803011956_osChina_微信收款码.png","wechatText":"微信打赏"},"fontsettings":{"family":"sans","size":2,"theme":"sepia"},"highlight":{},"anchor-navigation-ex":{"associatedWithSummary":true,"float":{"floatIcon":"fa fa-navicon","level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"mode":"float","multipleH1":true,"pageTop":{"level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"printLog":false,"showGoTop":true,"showLevel":true},"favicon":{"shortcut":"assets/images/favicon.ico","bookmark":"assets/images/favicon.ico"},"theme-comscore":{},"local-video":{},"copy-code-button":{},"versions":{"options":[{"value":"https://www.aivin666.cn/java_android/","text":"v1.0"}]},"sharing":{"all":["facebook","google","twitter","weibo","instapaper"],"facebook":false,"google":true,"instapaper":false,"twitter":false,"vk":false,"weibo":true},"edit-link":{"label":"托管页面","base":"https://www.baidu.com/"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"expandable-chapters":{},"search-plus":{}},"theme":"default","author":"Aivin","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Aivin开发笔记","language":"zh-hans","gitbook":"*","description":"Aivin开发笔记"},"file":{"path":"chinese/ndk/cmake方式.md","mtime":"2019-12-18T06:42:27.165Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-12-24T10:38:14.517Z"},"basePath":"../..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../../gitbook/gitbook.js"></script>
    <script src="../../gitbook/theme.js"></script>
    
        
        <script src="../../gitbook/gitbook-plugin-search-plus/jquery.mark.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search-plus/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-copy-code-button/toggle.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-versions-select/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-donate/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-local-video/video.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-edit-link/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-theme-comscore/test.js"></script>
        
    

    </body>
</html>

